/*  1:   */ package org.jetbrains.jps.model.serialization.runConfigurations;
/*  2:   */ 
/*  3:   */

import com.intellij.openapi.util.JDOMUtil;
import com.intellij.util.containers.hash.HashMap;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;

import java.util.Iterator;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */ 
/* 16:   */ public class JpsRunConfigurationSerializer
/* 17:   */ {
/* 18:   */   public static void loadRunConfigurations(@NotNull JpsProject paramJpsProject, @Nullable Element paramElement)
/* 19:   */   {
/* 20:34 */     if (paramJpsProject == null) {
/* 21:34 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/runConfigurations/JpsRunConfigurationSerializer", "loadRunConfigurations" }));
/* 22:   */     }
/* 23:34 */     HashMap localHashMap = new HashMap();
/* 24:35 */     for (Iterator localIterator = JpsModelSerializerExtension.getExtensions().iterator(); localIterator.hasNext();)
/* 25:   */     {
/* 26:35 */       localObject1 = (JpsModelSerializerExtension)localIterator.next();
/* 27:36 */       for (localObject2 = ((JpsModelSerializerExtension)localObject1).getRunConfigurationPropertiesSerializers().iterator(); ((Iterator)localObject2).hasNext();)
/* 28:   */       {
/* 29:36 */         localJpsRunConfigurationPropertiesSerializer = (JpsRunConfigurationPropertiesSerializer)((Iterator)localObject2).next();
/* 30:37 */         localHashMap.put(localJpsRunConfigurationPropertiesSerializer.getTypeId(), localJpsRunConfigurationPropertiesSerializer);
/* 31:   */       }
/* 32:   */     }
/* 33:   */     Object localObject1;
/* 34:   */     Object localObject2;
/* 35:   */     JpsRunConfigurationPropertiesSerializer localJpsRunConfigurationPropertiesSerializer;
/* 36:41 */     for (localIterator = JDOMUtil.getChildren(paramElement, "configuration").iterator(); localIterator.hasNext();)
/* 37:   */     {
/* 38:41 */       localObject1 = (Element)localIterator.next();
/* 39:42 */       if (!Boolean.parseBoolean(((Element)localObject1).getAttributeValue("default")))
/* 40:   */       {
/* 41:46 */         localObject2 = ((Element)localObject1).getAttributeValue("type");
/* 42:47 */         localJpsRunConfigurationPropertiesSerializer = (JpsRunConfigurationPropertiesSerializer)localHashMap.get(localObject2);
/* 43:48 */         if (localJpsRunConfigurationPropertiesSerializer != null) {
/* 44:49 */           a((Element)localObject1, localJpsRunConfigurationPropertiesSerializer, paramJpsProject);
/* 45:   */         }
/* 46:   */       }
/* 47:   */     }
/* 48:   */   }
/* 49:   */   
/* 50:   */   private static <P extends JpsElement> void a(Element paramElement, JpsRunConfigurationPropertiesSerializer<P> paramJpsRunConfigurationPropertiesSerializer, JpsProject paramJpsProject)
/* 51:   */   {
/* 52:57 */     JpsElement localJpsElement = paramJpsRunConfigurationPropertiesSerializer.loadProperties(paramElement);
/* 53:58 */     paramJpsProject.addRunConfiguration(paramElement.getAttributeValue("name"), (JpsRunConfigurationType)paramJpsRunConfigurationPropertiesSerializer.getType(), localJpsElement);
/* 54:   */   }
/* 55:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.serialization.runConfigurations.JpsRunConfigurationSerializer

 * JD-Core Version:    0.7.0.1

 */